import Api from '@/api/payment/payMethods'
import i18n from "@/lang/index";
import ExportsApi from '@/api/system/exports'
const contentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: false,
    // 'show-summary': true
  },
  indexAction: (data) => {
    console.log("index", data);
    return new Promise((resolve, reject) => {
      Api.getList(data).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        console.log(e);
        reject(e)
      })
    });
  },
  deleteAction: function (id) {
    console.log("delete", id);
    return new Promise((resolve, reject) => {
      Api.del({ id }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.7"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  exportAction: function (queryParams) {
    // 导出Excel文件
    return new Promise((resolve, reject) => {
      ExportsApi.add({ ...queryParams, ...{ type: 'deposit' } }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.85"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  pk: "id",
  toolbar: [
    "refresh",
    "add",
    // "delete",
    // "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: "导入",
    //   auth: "import",
    // },
  ],
  cols: [
    { type: "selection", minWidth: 50, align: "center" },
    { label: "ID", align: "center", prop: "id",minWidth:80 },
    { label: i18n.global.t("label.12"), align: "center", prop: "currency_code" },
    { label: i18n.global.t("label.101"), align: "center", prop: "name" },
    { label: i18n.global.t("label.39"), align: "center", prop: "payment_provider_id", templet: 'custom',minWidth: 150 },
    { label: i18n.global.t("label.18"), align: "center", prop: "type", templet: 'custom', slotName: "type" ,minWidth: 150},
    { label: i18n.global.t("label.23"), align: "center", prop: "status", templet: 'custom', slotName: "status",minWidth: 150 },
    { label: i18n.global.t("label.36"), align: "center", prop: "sort", minWidth: 150},
    { label: i18n.global.t("label.38"), align: "center", type: "time", prop: "created_at", minWidth: 180 },
    {
      label: i18n.global.t("label.8"),
      fixed: "right",
      width: 180,
      align: "center",
      templet: "tool",
      operat: [
        // {
        //   icon: "Document",
        //   name: "details",
        //   text: "手动确认",
        // },
        "edit",
        "delete",
      ],
    },
  ],
};

export default contentConfig;
